package com.caifeng.myapplication;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ExpandableListView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import java.util.ArrayList;
import java.util.List;

public class Vgroupchat extends Fragment {
    private View view;

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        view = inflater.inflate(R.layout.two_groupchat, null);

        init();

        return view;
    }

    private ExpandableListView expandableListView_groupchat;

    private void init() {
        expandableListView_groupchat = (ExpandableListView) view.findViewById(R.id.ch_list);
        VgroupchatAdapter vgroupchatAdapter =
                new VgroupchatAdapter(getData(), getActivity());
        expandableListView_groupchat.setAdapter(vgroupchatAdapter);


    }

    private List<VgroupchatGroupBean> getData() {
        List<VgroupchatGroupBean> mList = new ArrayList<>();
        /**
         * 第一组
         */
        VgroupchatGroupBean vgroupchatGroupBean = new VgroupchatGroupBean();
        vgroupchatGroupBean.setChat_title("我管理的群聊");
        vgroupchatGroupBean.setChat_num("1");

        List<VgroupchatGroupBean.VgroupchatChildBean> childBeanList = new ArrayList<>();
        VgroupchatGroupBean.VgroupchatChildBean vgroupchatChildBean = vgroupchatGroupBean.new VgroupchatChildBean();
        vgroupchatChildBean.setChat_ch_imag(R.mipmap.alb);
        vgroupchatChildBean.setChat_name("zz");
        childBeanList.add(vgroupchatChildBean);



        vgroupchatGroupBean.setmList(childBeanList);
        mList.add(vgroupchatGroupBean);

        /**
         *第二组
         */
        vgroupchatGroupBean = new VgroupchatGroupBean();
//            vfenzuGroupBean
        vgroupchatGroupBean.setChat_title("我加入的群聊");
        vgroupchatGroupBean.setChat_num("2");

        childBeanList = new ArrayList<>();
       vgroupchatChildBean= vgroupchatGroupBean.new VgroupchatChildBean();
        vgroupchatChildBean.setChat_ch_imag(R.mipmap.alc);
        vgroupchatChildBean.setChat_name("17软工");
        childBeanList.add(vgroupchatChildBean);
//        mList = new ArrayList<>();

        vgroupchatChildBean= vgroupchatGroupBean.new VgroupchatChildBean();
        vgroupchatChildBean.setChat_ch_imag(R.mipmap.alb);
        vgroupchatChildBean.setChat_name("zz");
        childBeanList.add(vgroupchatChildBean);


        vgroupchatGroupBean.setmList(childBeanList);
        mList.add(vgroupchatGroupBean);

        return mList;

    }

}
